<%@include file="/WEB-INF/views/includes/taglibs.jsp"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@include file="/WEB-INF/views/includes/adminHeader.jsp"%>

<script type="text/javascript">
$(function(){  
    $("#beginFetchDate").datepicker({  
        changeMonth: true, changeYear: true,   
        minDate: '-20y', maxDate: '+0y',
        showButtonPanel: true
    });  

    $('#beginFetchTime').timepicker();
});  
</script>
<div class="homePage ui-tabs-panel ui-widget-content ui-corner-bottom">
	<div id="leftMenu">
		<%@include file="/WEB-INF/views/includes/functionAdminLeftNav.jsp"%>
	</div>
	<div id="rightContent">
		<%@include file="/WEB-INF/views/includes/messages.jsp"%>
		<h2>Edit Function under Provider <font style="color:#2e6e9e">${selectedBizSystem.name}<input type="hidden" name="bizsysId" value="${selectedBizSystem.id}" id="bizsysid"/></font></h2>
		<form:form method="post" action="submitEditFunction" id="editFunctionform">
		<input id="bizsysId" name="bizsysId" type="hidden" value="${selectedBizSystem.id }"/>
		<div class="subTitle">Basic Information</div>
		<div class="subContent">
			<table style="width:100%">
				<tr>
					<td style="width:250px;"><form:label path="functionID">Function ID</form:label></td>
					<td>${command.functionID}<form:input path="functionID" type="hidden"/></td>
				</tr>
				<tr>
					<td><form:label path="functionName">Function Name</form:label></td>
					<td><form:input path="functionName" autocomplete="off"/></td>
				</tr>
				<tr>
					<td><form:label path="typeId">Function Type</form:label></td>
					<td><form:select path="typeId" autocomplete="off">
							<form:options items="${functionTypes}"  itemValue="id" itemLabel="name" />
					</form:select></td>
				</tr>
				<tr>
					<td><form:label path="datafetchID">Data Fetch ID</form:label></td>
					<td><form:input path="datafetchID" autocomplete="off"/><span class="fieldNote">The ID sent to your business system for getting function data.</span></td>
				</tr>
				<tr>
					<td><form:label path="dataUniqueKey">Data Unique Key</form:label></td>
					<td><form:input path="dataUniqueKey" autocomplete="off"/><span class="fieldNote">Separate multiple keys by comma, e.g. key1,key2,key3.</span></td>
				</tr>
				<tr>
					<td><form:label path="connectorConfigId">Provider Connector configure</form:label></td>
					<td><form:select path="connectorConfigId" autocomplete="off">
							<option value="0">----Not selected----</option>
							<form:options items="${functionConnConfs}"  itemValue="connectorId" itemLabel="listLabel" />
					</form:select><span class="fieldNote"><a target="_blank" href="<c:url value='/web/connectorConfigures?bizsysid=${selectedBizSystem.id}'/>">Manage configures</a></span></td>
				</tr>
				<tr>
					<td>Begin Fetch Time</td>
					<td>Date&nbsp;<form:input
					path="beginFetchDate" style="width:120px"/>&nbsp;Time&nbsp;<form:input 
					path="beginFetchTime" style="width:80px"/></td>
				</tr>
			</table>
			</div>
			<div class="subTitle">Quick Actioner Settings</div>
			<div class="subContent">
				<table style="width:100%">
				<tr>
					<td style="width:250px;"><form:label path="clientLibraryFileName">Client Library File Name</form:label></td>
					<td><form:input path="clientLibraryFileName" autocomplete="off"/></td>
				</tr>
				<tr>
					<td><form:label path="clientClassName">Client Class Name</form:label></td>
					<td><form:input path="clientClassName" autocomplete="off"/></td>
				</tr>
				<tr>
					<td><form:label path="connectorLibraryFileName">Connector Library File Name</form:label></td>
					<td><form:input path="connectorLibraryFileName" autocomplete="off"/></td>
				</tr>
				<tr>
					<td><form:label path="connectorClassName">Connector Class Name</form:label></td>
					<td><form:input path="connectorClassName" autocomplete="off"/></td>
				</tr>
				<tr>
					<td><form:label path="layoutDefaultName">Function Display Name</form:label></td>
					<td><form:input path="layoutDefaultName" autocomplete="off"/><span class="fieldNote">This name will be displayed in the quick actioner.</span></td>
				</tr>
				<tr>
					<td><form:label path="layoutGroupId">Function Group</form:label></td>
					<td><form:select path="layoutGroupId" autocomplete="off">
							<form:options items="${functionLayoutGroups}"  itemValue="id" itemLabel="name" />
					</form:select><span class="fieldNote"><a href="<c:url value='/web/actionerGroupList'/>?bizsysId=${selectedBizSystem.id}">Manage groups</a></span></td>
				</tr>
				</table>
			</div>
			<button type="button"
				class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
				onclick="save()">
				<span class="ui-button-text">Save</span>
			</button>
			<button type="button"
				class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
				onclick="cancel()">
				<span class="ui-button-text">Cancel</span>
			</button>
			<script type="text/javascript">
				function save() {
					$('#editFunctionform').submit();
				}
				function cancel() {
					window.location.href = "<c:url value='/web/functionHome'/>";
				}
			</script>
		</form:form>
		<div style="height:1px;width:740px;"></div>
	</div>
</div>

<%@include file="/WEB-INF/views/includes/adminfooter.jsp"%>